<?php
/**
 * Created by PhpStorm.
 * User: zhana0
 * Date: 18-3-21
 * Time: 下午11:03
 */

function token_to_user($token)
{
    try{
        $user = \App\Model\Tokens::where('token','=',$token)->get();
        return $user['user_name'];
    } catch (\Exception $e)
    {
        return false;
    }
}

function create_user_id()
{
    return 'UID' . strtoupper(uniqid());
}

function create_token()
{
    return strtoupper(md5(uniqid()));
}

function create_msg_id()
{
    return 'MSG' . strtoupper(uniqid());
}